package main;

import interfaces.TextHandler;
import output.IRCOutput;

public class TextInputCentral {
   public static void addTextInput(final String message, final String sender, final String channel, final String preferredHandler) {
	  IRCOutput output = new IRCOutput(sender.equals(channel) ? Constants.PM_SOURCE : -1, sender.equals(channel) ? sender
			: channel, 2, preferredHandler);
	  for (TextHandler th : CommandSettings.INSTANCE.getTextHandlers()) {
		 if (th.willHandleText(message, sender, sender)) {
			boolean quit = th.handleText(message.replace("     ", "\t"), channel, sender, output);
			if (quit) {
			   break;
			}
		 }
	  }
	  Bot.getInstance().send(output);
   }
}
